Table card {
  card_id int [primary key,not null]
  card_name text [not null]
  card_hp int [not null, check: `card_hp > 0`]
  card_hieght numeric [not null]
  card_weight numeric [not null]
  card_rarity text [not null]
  card_number text [not null]
  card_artist text [not null]
  card_release_date date [not null]
  card_image_url text [not null]
  card_set_id int [not null, ref: > card_set.card_set_id]
  illustrator_id int [not null, ref: > illustrator.illustrator_id]
  card_pokemon_id int [not null]
  trainer_id int 
  indexes {
    (card_set_id, card_number) [unique]
    }
}


Table card_set {
  card_set_id int [primary key, not null]
  card_set_releaced_date date
  card_set_name text [not null, unique]
  card_set_code int  [not null, unique]
  card_set_total_cards int [not null, unique]
  card_set_release_date date [not null]
  card_set_logo_url text [not null]
  card_set_symbol_url text [not null]
}

Table attack {
  attack_id int [primary key, not null]
  attack_name text [not null]
  attack_base_damage text [null, check: `attack_base_damage >= 0`]
  attack_effect text
  attack_retreat_cost int [null]
}

Table card_attack {
  card_attack_id int [primary key]
  card_id int [not null, ref: > card.card_id]
  attack_id int [not null, ref: > attack.attack_id]
  card_attack_position int [null, check: `card_attack_position > 0`]
}

Table energy_type {
  energy_quantily text [null]
  energy_type_id int [primary key, not null]
  energy_type_name text [not null, unique]
  energy_type_icon_url text [not null]
}

Table illustrator {
  illustrator_name text [not null]
  illustrator_id int [primary key, not null]
  illustrator_nationality text [null]
}

Table attack_energy_cost {
  attack_energy_cost_id int [primary key]
  cost_link_id int [not null]
  attack_id int [not null]
  element_type_id int [not null]
 cost_quantity int [not null]
}

Table pokemon {
  pokemon_id int [primary key,not null]
  pokemon_name text [not null]
  pokemon_hp int [not null, check: `card_hp > 0`]
  pokemon_hieght text [not null]
  pokemon_weight text [not null] 
  pokemon_rarity text [not null]
  pokemon_number text [not null]
  pokemon_artist text [not null]
  pokemon_release_date date [not null]
  energy_type_id int [not null]
  attack_energy_cost_id int [not null]
  attack_id int [not null]
  pokemon_rare text [not null]
  trainer_id int [not null]
  pokemon_category text [not null]
  pokemon_pokedex_id int [not null]
  pokemon_stage text [not null]
  pokemon_evolves_from text [not null]
  pokemon_retreat_cost int [not null]
  pokemon_sub_type_id int [not null]

}

Table trainer {
  tranier_id int [primary key,not null]
  trainer_name text [not null, unique]
  trainer_effect_text text [not null]
  trainer_specification text [not null]
  trainer_description text [not null]
  trainer_type text [not null]
  trainer_released_date date [not null]
  trainer_rare text [not null]
  trainer_is_ace_spec logical [null, check: `trainer_is_ace_spec <= 1`]
}

Table pokemon_sub_type {
  syb_type_id int [not null, primary key]
  syb_type_name text [not null, unique]
  sub_type_default_prize_count int [not null,check: `sub_type_default_prize_count > 0`]
  sub_type_global_rule_text text [not null]
}

Table ability {
  ability_type_id int [not null, primary key]
  ability_type_name text [not null, unique]
}

Table attack_name {
  printed_type_id int [not null, primary key]
  printed_type_name text [not null,unique]

}

Table game_mechanic {
  mechanic_id int [not null, primary key]
  mechanic_name text [not null, unique]
}

Table pokemon_species {
  species_pokedex_number int [not null,primary key]
  species_eng_name text [not null,unique]
  species_generation int [not null]
  species_height_m float [not null]
  species_weight_kg float [not null]
}

Table pokedex_entry {
  entry_id int [not null, primary key]
  entry_pokedex_number int [not null]
  entry_source_game text [not null]
  entry_description text [not null]
}

Table energy_card {
  energy_card_id int [not null, primary key]
  energy_is_special logical [not null]
  energy_main_type_id int [not null]
  energy_effect_text text [null]
}

Table pokemon_ability {
  ability_pokemon_card_id int [not null, primary key]
  ability_type_id int [not null]
  ability_name text [not null]
  ability_effect_text text [not null]
}

Table pokemon_attack_link {
  link_id int [not null, primary key]
  link_pokemon_card_id int [not null]
  link_attack_name_id int [not null]
  link_damage_value text [not null]
  link_effect_text text [not null]
  indexes {
    (link_pokemon_card_id, link_attack_name_id) [unique]
    }
}
Table pokemon_attribute {
  attribute_id int [not null, primary key]
  attribute_pokemon_card_id int [not null]
  attribute_energy_type_id int [not null]
  attribute_kind text [not null]
  attribute_modifier_value text [not null]
  indexes {
    (attribute_pokemon_card_id, attribute_energy_type_id, attribute_kind) [unique]
    }
}
Table trainer_mechanic_link {
  mechanic_link_trainer_card_id int [not null]
  mechanic_link_mechanic_id int [not null,ref:]
  primary key (mechanic_link_trainer_card_id, mechanic_link_mechanic_id)
}


Ref: "pokemon"."pokemon_id" <? "card"."card_pokemon_id"

Ref: "pokemon"."attack_energy_cost_id" ?> "attack_energy_cost"."attack_energy_cost_id"

Ref: "pokemon"."attack_id" ?> "attack"."attack_id"

Ref: "pokemon"."energy_type_id" ?> "energy_type"."element_type_id"

Ref: "trainer"."tranier_id" <? "pokemon"."trainer_id"

Ref: "card"."trainer_id" ?>? "trainer"."tranier_id"